<admintpl file="header" />
<style type="text/css">
.pic-list li {
	margin-bottom: 5px;
}
</style>

</head>
<body>
	<div class="wrap js-check-wrap">
		<ul class="nav nav-tabs">
			<li class="active"><a href="{:U('AdminCard/refund',array('id'=>empty($item['id'])?'':$item['id']))}" target="_self">卡片退款</a></li>
		</ul>
		<form action="{:U('AdminCard/refund_post')}" method="post" class="form-horizontal js-ajax-forms" enctype="multipart/form-data" onsubmit="return ajax_sub();">
			<div class="row-fluid">
				<div class="span9">
					<table class="table table-bordered">
                        <if condition="$user_model == 2">
						<tr>
							<th>账户余额</th>
                            <td><input type="text"  name="balance" id="balance" value="{$logistics.balance}" style="width: 400px" readonly> </td>
						</tr>
                        </if>
                        <tr>
                            <th>退款卡号<span class="form-required">*</span></th>
                            <td><input type="text" name="card_number" id="card_number" class="require number" value="" style="width: 400px" placeholder="请输入绑定会员卡">
                                <input type="hidden" class="require" name="card_id"  id="card_id" value=""/>
                            </td>
                        </tr>
                        <tr>
                            <th>卡内余额</th>
                            <td><input type="text"  name="card_balance" id="card_balance" value="" style="width: 400px" readonly > </td>
                        </tr>
                        <tr>
                            <th>车牌号</th>
                            <td><input type="text"  name="car_code" id="car_code" value="" style="width: 400px" readonly > </td>
                        </tr>
                        <tr>
                            <th>会员</th>
                            <td><input type="text"  name="driver_name" id="driver_name" value="" style="width: 400px" readonly > </td>
                        </tr>
                        <tr>
                            <th>赠送</th>
                            <td><input type="text"  name="admin_card_give_price" id="admin_card_give_price" value="" style="width: 400px" readonly > </td>
                        </tr>
                        <tr>
                            <th>卡费</th>
                            <td><input type="text"  name="admin_card_active_price" id="admin_card_active_price" value="" style="width: 400px" readonly > </td>
                        </tr>
                        <tr>
                            <th>退款金额<span class="form-required">*</span></th>
                            <td><input type="text" class="require number" name="refund_price" id="refund_price" value="" style="width: 400px"  placeholder="请输入退款金额"> </td>
                        </tr>
                        <tr>
                            <th>描述</th>
                            <td><input type="text" name="desc" id="desc" value="" style="width: 400px" placeholder="请输入描述"> </td>
                        </tr>

                    </table>
				</div>

			</div>
			<div class="form-actions">
                <input type="hidden" name="id" value="{$item.id}"/>
				<button class="btn btn-primary js-ajax-submit" type="submit">提交</button>
				<a class="btn" href="{:U('AdminCard/index')}">返回</a>
			</div>
		</form>
	</div>
    <script type="text/javascript">
        var substatus = true;
        function ajax_sub(){
            if (substatus) {
                substatus = false;
                if (checkform() && confirm('是否确认进行退款操作？')) {
                    return true;
                }
            }else{
                substatus = true;
                return false;
            }
        }


        // $(document).ready(function () {
        //     $("#select_card_number").quicksearch(".card_number_list li", {
        //         noResults: '.no_card_number_list'
        //     });
        //     $("#card_number,#select_card_number").click(function(){
        //         event.stopPropagation();
        //         $('.card_number_list').show();
        //         return false;
        //     });
        //     $("body").click(function(){
        //         $(".div_quicksearch").hide();
        //     });
        //     $("#select_card_number").keypress(function (e) { //这里给function一个事件参数命名为e，叫event也行，随意的，e就是IE窗口发生的事件。

        //         var key = e.which; //e.which是按键的值
        //         var is_select = false;
        //         if (key == 13) {
        //             setTimeout(function(){
        //                 $(".card_number_list li").each(function(){
        //                    var disp = $(this).css("display");
        //                    if(disp != 'none'){
        //                        is_select = true;
        //                        $(this).click();
        //                         return false;
        //                    }
        //                 });
        //                 if(!is_select){
        //                     alert("该卡号不存在!");
        //                 }
        //             },300);
        //             return false;
        //         }
        //     });

        //     });
        function change_card_id(){
            var card_number = $("#card_number").val();

            $.ajax({url:"{:U('AdminCard/ajax_get_card')}",async:false,dataType:"json",data:"card_number="+card_number,type:"post",success:function(t){
                    if(t.code == 1){
                        var temp = t.data;
                        $("#card_id").val(temp.id);
                        $("#card_balance").val(temp.balance);
                        $("#car_code").val(temp.car_code);
                        $("#driver_name").val(temp.driver_name);
                        $("#admin_card_give_price").val(temp.admin_card_give_price);
                        $("#admin_card_active_price").val(temp.admin_card_active_price);
                    }else{
                        alert(t.data);
                    }
            }});
        }
        $('#card_number').change(function(){
            change_card_id();
        });
        
        // function quick_select(id,val,id2,val2){
        //     $("#"+id).val(val);
        //     $("#"+id2).val(val2);
        //     change_card_id();
        // }
    </script>

	<script type="text/javascript" src="__PUBLIC__/js/common.js?5"></script>
	</body>
</html>